#ifndef TRIANGLE_APP_HPP
#define TRIANGLE_APP_HPP

#include "app/base_app.hpp"
#include "gl/gl_utils.hpp"

struct Camera {
    enum MoveDir {
        MD_FORWARD = 0x1,
        MD_BACKWARD = 0x2,
        MD_LEFT = 0x4,
        MD_RIGHT = 0x8,
    };

    glm::vec3 position;
    glm::vec3 lookAt;
    int move_dir{ 0 };
//
//    void Update(double delta_time);
//
//    void Dir(MoveDir dir, bool enable);
//
//    void Rotate(int degree);
};

class TriangleApp final : public App {
public:
    TriangleApp(GLFWwindow *w, const char* name);
    ~TriangleApp();

    void OnInitialize() override;
    void OnCleanup() override;

protected:

    void RenderFrame(double delta_time, double total_time) override;
    void RenderConfigUI() override;

    void OnKey(int key, int modifiers, bool is_press) override;
    void OnWheelScroll(int dx, int dy) override;

private:
    GL::ProgramPtr m_program_;
    GL::VertexArrayPtr m_vao_;
    GL::TexturePtr m_image_;
    Camera m_camera_;
    float m_radius_;
    bool  m_enable_clip_;
    float m_rotate_rpm_;
    float m_rotate_degrees_;
};

#endif// TRIANGLE_APP_HPP
